﻿using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("请输入一行字符：");
        string input = Console.ReadLine();

        if (string.IsNullOrEmpty(input))
        {
            Console.WriteLine("输入为空，请重新运行程序并输入字符。");
            return;
        }

        // 初始化计数器
        int letters = 0;
        int digits = 0;
        int spaces = 0;
        int others = 0;

        // 遍历每个字符并进行分类统计
        foreach (char c in input)
        {
            if (char.IsLetter(c))
            {
                letters++;
            }
            else if (char.IsDigit(c))
            {
                digits++;
            }
            else if (char.IsWhiteSpace(c))
            {
                spaces++;
            }
            else
            {
                others++;
            }
        }

        // 输出统计结果
        Console.WriteLine($"\n统计结果：");
        Console.WriteLine($"英文字母: {letters} 个");
        Console.WriteLine($"数字: {digits} 个");
        Console.WriteLine($"空格: {spaces} 个");
        Console.WriteLine($"其它字符: {others} 个");

        // 可选：显示百分比
        int total = input.Length;
        Console.WriteLine($"\n百分比：");
        Console.WriteLine($"英文字母: {(double)letters / total * 100:F2}%");
        Console.WriteLine($"数字: {(double)digits / total * 100:F2}%");
        Console.WriteLine($"空格: {(double)spaces / total * 100:F2}%");
        Console.WriteLine($"其它字符: {(double)others / total * 100:F2}%");
    }
}